fix recompute --reproducible run on a VURL key
authorJoey Hess <joeyh@joeyh.name>
Wed, 12 Mar 2025 15:48:29 +0000 (11:48 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 12 Mar 2025 15:48:29 +0000 (11:48 -0400)
This avoids "Cannot generate a key for backend VURL", and makes it use
the usual hashing backend.

Command/AddComputed.hs
Command/Recompute.hs

index 50c0ee28f6e2b791cba0bced77640954c569c020..dd6c310b061615c6e8e49eab98db2ab8fa7c4a15 100644 (file)
@@ -52,6 +52,7 @@ optParser desc = AddComputedOptions
        <*> parseReproducible
 
 newtype Reproducible = Reproducible { isReproducible :: Bool }
+       deriving (Show, Eq)
 
 parseReproducible :: Parser (Maybe Reproducible)
 parseReproducible = r <|> unr
index b85f5d449d08a9915b12f06f2466ec1d68346e75..17246d10e469f3a449074f9752b378e878028555 100644 (file)
@@ -21,7 +21,7 @@ import Annex.GitShaKey
 import Git.FilePath
 import Logs.Location
 import Command.AddComputed (Reproducible(..), parseReproducible, getInputContent, getInputContent', addComputed)
-import Backend (maybeLookupBackendVariety, unknownBackendVarietyMessage)
+import Backend (maybeLookupBackendVariety, unknownBackendVarietyMessage, chooseBackend)
 import Types.Key
 
 import qualified Data.Map as M
@@ -200,7 +200,11 @@ perform o r file origkey origstate = do
                                        logStatus NoLiveUpdate origkey InfoMissing
                return True
 
-       choosebackend _outputfile
+       choosebackend outputfile
+               -- When converting a VURL to reproducible, can't use
+               -- the VURL backend.
+               | recomputingvurl && reproducible o == Just (Reproducible True) =
+                       chooseBackend outputfile
                -- Use the same backend as was used to compute it before,
                -- so if the computed file is the same, there will be
                -- no change.